<style type="text/css" media="screen">
    #uploadPreview div{
        width: 168px;
        height: 168px;                         
        background-position: center center;
        background-size: cover;
        border: 4px solid #fff;
        -webkit-box-shadow: 0 0 1px 1px rgba(0, 0, 0, .3);
        display: inline-block;
    }
</style>
<div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="<?=site_url('admini')?>">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="<?=site_url('admini/store')?>">商铺管理</a><span class="crumb-step">&gt;</span><span>修改商铺</span></div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form action="<?=site_url('admini/store/operation')?>" method="post" id="myform" name="myform" enctype="multipart/form-data">
                    <table class="insert-tab" width="100%">
                        <tbody>
                            <tr width="120">
                                <th><i class="require-red">*</i>商铺名称：</th>
                                <td>
                                    <input class="common-text required" id="title" name="s_name" size="50" value="<?=$res['s_name']?>" type="text">
                                </td>
                            </tr>
                            <tr>
                                <th><i class="require-red">*</i>联系人：</th>
                                <td><input class="common-text" name="contact" size="50" value="<?=$res['contact']?>" type="text"></td>
                            </tr>
                            
                            <tr>
                                <th><i class="require-red">*</i>联系电话：</th>
                                <td><input class="common-text" name="phone" size="50" value="<?=$res['phone']?>" type="text"></td>
                            </tr>

                            <tr>
                                <th><i class="require-red">*</i>联系邮箱：</th>
                                <td><input class="common-text" name="email" size="50" value="<?=$res['email']?>" type="text"></td>
                            </tr>

                            <tr>
                                <th><i class="require-red">*</i>logo：</th>
                                <td><input name="logo" id="uploadImage" type="file"><!--<input type="submit" onclick="submitForm('/jscss/admin/design/upload')" value="上传图片"/>--></td>
                            </tr>
                            <tr style="" id="uploadPreview">
                                <th><i class="require-red">*</i>预览：</th>
                                <td><div style="background-image:url(<?=$res['logo']?>)"></div></td>
                            </tr>
                            <tr>
                                <th>店铺简介：</th>
                                <td><textarea name="introduce" class="common-textarea" id="content" cols="30" style="width: 98%;" rows="10"><?=$res['introduce']?></textarea></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td>
                                    <input type="hidden" name="id" value="<?=$res['id']?>">
                                    <input class="btn btn-primary btn6 mr10" value="提交" type="submit">
                                    <input class="btn btn6" onclick="history.go(-1)" value="返回" type="button">
                                    <span>带<i class="require-red">*</i>符号的为必填项目</span>
                                </td>
                            </tr>
                        </tbody></table>
                </form>
            </div>
        </div>
<script>
//图片上传预览
$("#uploadImage").change( function(){

    // Get a reference to the fileList
    var files = !!this.files ? this.files : [];
  
    // If no files were selected, or no FileReader support, return
    if (!files.length || !window.FileReader) return;
  
    // Only proceed if the selected file is an image
    if (/^image/.test( files[0].type)){
  
        // Create a new instance of the FileReader
        var reader = new FileReader();
  
        // Read the local file as a DataURL
        reader.readAsDataURL(files[0]);
  
        // When loaded, set image data as background of div
        reader.onloadend = function(){
   
       $("#uploadPreview div").css("background-image", "url("+this.result+")");
         
        }
    $("#uploadPreview").attr("style","");
    }
  
});
$('#myform').submit(function() {
    $(this).ajaxSubmit(function(data){
        if(data == 1){
            layer.alert('修改商铺成功！',{
                icon:1,
            },function(){
                location.href="<?=site_url('admini/store/index')?>";
            });
        }else{
            layer.alert(data,{
                icon:2,
            });
        }
    })
    return false;
})
</script>